
begintalkscript;

variables;
int pc_counter, in_inn;

begintalknode 10;
	state = -1;
	nextstate = 10;
	question = "Felix";
	text1 = "This young priest looks disheveled. His robes are grimy and frayed, and his face has a tortured look of concentration about it. He acknowledges you with a pained squint.";
	text2 = "_My name's Felix. What do you want?_";
	text3 = "He doesn't really sound unfriendly, so much as he sounds like he's trying to keep from screaming.";
	text5 = "Felix still looks like he's in pain, but at least he's paying attention to you.";
	text6 = "_Could we speed this up? I'm trying to preserve my sanity._";
	action = INTRO;
	code = 
		if(get_flag(8,1) != 1)
			remove_string(6);
	break;
begintalknode 11;
	state = 10;
	nextstate = -1;
	question = "What's wrong?";
	text1 = "Felix twitches and yelps. _It's the ghosts. Some of the wards failed for some reason. Now there's just a few runes between them and me, and that's not stopping them from getting a head start._";
	text2 = "_They're trying to break my willpower, but I won't let them. By the winds, it's my duty to keep the catacombs, and I won't let them keep me from it._";
	text3 = "He shudders and winces at the same time, which just looks unpleasant.";
	text5 = "Felix twitches. _I told you already. The ghosts are trying to break me. Leave me alone._";
	code = 
		if(get_flag(8,1) == 1) {
			clear_strings();
			add_string(5);
		}
		else {
		remove_string(5);
		set_flag(8,1,1);
	}
	break;
begintalknode 12;
	state = 10;
	nextstate = -1;
	condition = (get_flag(1,4) > 0) && (party_size() == 1) && (get_flag(8,2) == 0);
	question = "Father Richardson told me to speak to you.";
	text1 = "_Okay, so you know that we've got ghosts. But there's more that you really need to know. The reason we have this problem in the first place is because some of the cathedral's wards have failed,_ he says, shuddering.";
	text2 = "_We're not sure which wards need fixing, but I think it's in the most recent tomb. A platoon of soldiers was interred there not long ago. For some reason, the Empire insisted that we install a suppression field generator in that one._";
	text3 = "He hesistantly pulls a small crystal from his robes, and hands it to you. _To get to the tomb, go out the door, all the way down the hall, and make two rights. Be careful not to rub out the runes in front of the door, because then they'll escape._";
	text4 = "_When you get in there, look for the machine at the back of the tomb, and swap out this crystal for the one that's currently sticking out of the top. With any luck, it'll help control the ghosts. Just do it quickly._";
	text5 = "He shakes violently and furrows his brow. _You should leave now. And hurry!_";
	action = END_TALK;
	code = 
		set_flag(8,2,1);
		clear_quest(3);
		toggle_quest(4,1);
		reward_give(445);
	break;
begintalknode 13;
	state = 10;
	nextstate = -1;
	condition = (get_flag(1,4) > 0) && (party_size() != 1) && (get_flag(8,2) == 0);
	question = "Father Richardson told us to speak to you.";
	text1 = "_Okay, so you know that we've got ghosts. But there's more that you really need to know. The reason we have this problem in the first place is because some of the cathedral's wards have failed,_ he says, shuddering.";
	text2 = "_We're not sure which wards need fixing, but I think it's in the most recent tomb. A platoon of soldiers was interred there not long ago. For some reason, the Empire insisted that we install a suppression field generator in that one._";
	text3 = "He hesistantly pulls a small crystal from his robes, and hands it to you. _To get to the tomb, go out the door, all the way down the hall, and make two rights. Be careful not to rub out the runes in front of the door, because then they'll escape._";
	text4 = "_When you get in there, look for the machine at the back of the tomb, and swap out this crystal for the one that's currently sticking out of the top. With any luck, it'll help control the ghosts. Just do it quickly._";
	text5 = "He shakes violently and furrows his brow. _You should leave now. And hurry!_";
	action = END_TALK;
	code = 
		set_flag(8,2,1);
		clear_quest(3);
		toggle_quest(4,1);
		reward_give(445);
	break;
begintalknode 14;
	state = 10;
	nextstate = -1;
	condition = (get_flag(8,1) == 1) || (get_flag(8,2) == 1);
	question = "What are the wards?";
	text1 = "Felix takes a deep breath before speaking. _Well, the cathedral has two types of wards against the undead. First, the entire building is blessed so that spirits and the undead cannot leave. These wards are incredibly strong._";
	text2 = "_However, stronger spirits, such as our angry soldier friends here, could possibly break through this defense if given enough time. Thus, we have a second line of wards created by some of the wisest mages in Aizo._";
	text3 = "_These machines radiate a suppression field throughout the cathedral, disrupting any unruly spirits. So it looks like one of the machines might be out of power, or simply broken. That's what we need you to check._";
	text4 = "He shudders. _If the machines fail completely, the ghosts will probably escape. I don't want to think about what they'll do before leaving._";
	text5 = "He glares at you. _I told you, we have two sets of wards: holy blessings and suppression field generators. We believe the latter are broken._";
	code = 
		if(get_flag(8,3) == 1) {
			clear_strings();
			add_string(5);
		}
		else {
		remove_string(5);
		set_flag(8,3,1);
	}
	break;
begintalknode 15;
	state = 10;
	nextstate = -1;
	question = "What is your job here?";
	text1 = "_I tend the catacombs. Mostly, it's just sweeping up and setting traps for rats, but now it involves trying to keep ghosts from driving me insane._";
	text2 = "He coughs and clutches his chest. _It's difficult now, and it wasn't before. I envy the others, particularly Paula. All she has to do is tend the gardens, and if I had to pick somewhere safe to be right now, it'd be outside of the cathedral._";
	text5 = "_I told you. I am in charge of the catacombs,_ he says, coughing a bit.";
	code = 
		if(get_flag(8,4) == 1) {
			clear_strings();
			add_string(5);
		}
		else {
		set_flag(8,4,1);
		remove_string(5);
	}
	break;
begintalknode 16;
	state = 10;
	nextstate = -1;
	condition = (get_flag(8,2) == 1) && (party_size() != 1);
	question = "Is there any other advice you can give us?";
	text1 = "_Two things. First, don't mess up the runes out in front of the tomb. Second, switch the crystals as fast as possible. If you fail at either, then you're that much more likely to be attacked._";
	text2 = "He gasps for what appears to be no reason. _And hurry!_";

begintalknode 17;
	state = 10;
	nextstate = -1;
	condition = (get_flag(8,2) == 1) && (party_size() == 1);
	question = "Is there any other advice you can give me?";
	text1 = "_Two things. First, don't mess up the runes out in front of the tomb. Second, switch the crystals as fast as possible. If you fail at either, then you're that much more likely to be attacked._";
	text2 = "He gasps for what appears to be no reason. _And hurry!_";

begintalknode 18;
	state = 10;
	nextstate = -1;
	condition = get_flag(8,2) == 1;
	question = "Which way was it to get to the tomb?";
	text1 = "Felix twitches. _Go out the door to the east, go straight down the hall, then make two rights._";

begintalknode 30;
	state = -1;
	nextstate = 30;
	question = "Ghost";
	text1 = "Unlike the soldiers, this ghost has not kept its shape. Instead, the vaguely-humanoid spirit seems to be contemplating its own grave.";
	text2 = "Like most of the ghosts you've seen, this ghost has not kept the shape it had in life. Instead, the vaguely-humanoid spirit seems to be contemplating its own grave.";
	text3 = "Surprisingly, it notices you.";
	text4 = "_What do you want?_ it asks, with a thin, reedy voice.";
	text5 = "The ghost is still here, staring at its grave. It acknowledges your presence with a brief shake of its head.";
	text6 = "The ghost is still here, and it doesn't seem to want to talk to you anymore. Instead, it just floats there talking to itself.";
	text7 = "_My name is Robert Paulsen. My name is Robert Paulsen..._ he says, over and over.";
	action = INTRO;
	code = 
		if(get_flag(50,0) == 1)
			remove_string(2);
		else
		remove_string(1);
		
		if(get_flag(11,10) != 2) {
			remove_string(6);
			remove_string(7);
		}
		else {
		remove_string(5);
		end();
	}
	break;
begintalknode 31;
	state = 30;
	nextstate = -1;
	condition = (get_flag(11,10) == 1) && (get_flag(8,12) == 1);
	question = "(Tell him about his statue upstairs)";
	text1 = "You describe the memorial to the ghost. It doesn't speak for a while.";
	text2 = "_So... my name. It's Robert Paulsen,_ it says, stopping as if to let this sink in. _I have a name, even in death._";
	text3 = "It looks up at the ceiling. _They remembered me. They actually remembered me._";
	text4 = "It doesn't speak to you anymore, instead beginning to mutter to itself.";
	action = END_TALK;
	code = 
		set_name(35, "Robert Paulsen");
		set_flag(11,10,2);
	break;
begintalknode 32;
	state = 30;
	nextstate = -1;
	condition = get_flag(11,10) < 2;
	question = "Who were you?";
	text1 = "The ghost seems to balk at this question.";
	text2 = "_I... I don't know. I don't know my name. All I know is that I built this,_ it says, waving an ethereal limb at the chamber. _I built it all._";
	text3 = "_They didn't remember me. If they'd remembered me, I'd remember myself. But I'm too weak to find if they've remembered me, so I can't know myself._";
	code = 
		set_flag(8,12,1);
	break;
begintalknode 33;
	state = 30;
	nextstate = -1;
	question = "Why aren't you attacking?";
	text1 = "_Attack?_ the ghost asks, making the word sound foreign and bizarre. _Why would I..._";
	text2 = "The ghost just stops mid-sentence, causing a short and awkward silence. _What was I saying?_";

begintalknode 40;
	state = -1;
	nextstate = -1;
	question = "Ghost";
	text1 = "Unlike the soldiers, this ghost has not kept its shape. Instead, the vaguely-humanoid spirit seems to be slumped over in the corner of the chamber, sobbing loudly.";
	text2 = "Like most of the ghosts you've seen, this ghost has not kept the shape it had in life. Instead, the vaguely-humanoid spirit seems to be slumped over in the corner of the chamber, sobbing loudly.";
	text3 = "It doesn't appear to be interested in conversation.";
	text5 = "The ghost is still slumped over in the corner, crying.";
	action = INTRO;
	code = 
		if(get_flag(50,0) == 1)
			remove_string(2);
		else
		remove_string(1);
	break;
begintalknode 45;
	state = -1;
	nextstate = -1;
	question = "Ghost";
	text1 = "Unlike the soldiers, this ghost has not kept its shape. Instead, the vaguely-humanoid spirit floats around the chamber aimlessly, not really noticing your presence.";
	text2 = "Like most of the ghosts you've seen, this ghost has not kept the shape it had in life. Instead, the vaguely-humanoid spirit floats around the chamber aimlessly, not really noticing your presence.";
	code = 
		if(get_flag(50,0) == 1)
			remove_string(2);
		else
		remove_string(1);
	break;
begintalknode 50;
	state = -1;
	nextstate = -1;
	question = "Ghost";
	text1 = "Unlike the soldiers, this ghost has not kept its shape. Instead, the vaguely-humanoid spirit floats in front of a brazier, muttering strange syllables under its breath. You can't understand a word of it, but it sounds angry.";
	text2 = "Like most ghosts you've seen, this ghost has not kept the shape it had in life. Instead, the vaguely-humanoid spirit floats in front of a brazier, muttering strange syllables under its breath. You can't understand a word of it, but it sounds angry.";
	text3 = "The ghost gives no indication that it cares about your existence.";
	code = 
		if(get_flag(50,0) == 1)
			remove_string(2);
		else
		remove_string(1);
	break;
begintalknode 55;
	state = -1;
	nextstate = -1;
	question = "Ghost";
	text1 = "Unlike the soldiers, this ghost has not kept its shape. Instead, the vaguely-humanoid spirit floats around the chamber aimlessly, gibbering away in a language you cannot understand.";
	text2 = "Like most of the ghosts you've seen, this ghost has not kept the shape it had in life. Instead, the vaguely-humanoid spirit floats around the chamber aimlessly, gibbering away in a language you cannot understand.";
	text3 = "Whether it's an ancient tongue or just mad ranting, you cannot understand a word of it.";
	code = 
		if(get_flag(50,0) == 1)
			remove_string(2);
		else
		remove_string(1);
	break;
begintalknode 60;
	state = -1;
	nextstate = 60;
	question = "Ghost";
	text1 = "Unlike the soldiers, this ghost has not kept its shape. At least, not nearly as well... the shape is undeniably human, but its features aren't as distinct as the soldiers'. You can see vague wisps of what might've once been a robe.";
	text2 = "Like most ghosts you've seen, this ghost has not kept its shape. At least, not very well... the shape is undeniably human, but its features aren't as distinct as the soldiers'. You can see vague wisps of what might've once been a robe.";
	text3 = "_Greetings, I am..._ the ghost says, before trailing off. _My name is not important._";
	text5 = "The nameless ghost is still here, floating about its chamber.";
	action = INTRO;
	code = 
		if(get_flag(50,0) == 1)
			remove_string(2);
		else
		remove_string(1);
	break;
begintalknode 61;
	state = 60;
	nextstate = -1;
	question = "Who were you?";
	text1 = "The ghost furrows what might've been a brow once, and stares at the ceiling. ";
	text2 = "_I'm not sure... I think I used to be a priest,_ it says, and a few more stray strands of a faded robe flash into being around its indistinct form.";
	text3 = "_That's it. I was a priest._";
	text4 = "_I am... no, was. I was,_ the ghost says before trailing off into silence for a moment.";
	text5 = "_That's it. I was the head priestess of the church. I fought a battle, and I won it,_ she says, as an incorporeal robe flickers into existence around her.";
	code = 
		set_flag(8,14,1);
		if(get_flag(8,13) == 2) {
			remove_string(1);
			remove_string(2);
			remove_string(3);
		}
		else {
		remove_string(4);
		remove_string(5);
	}
	break;
begintalknode 62;
	state = 60;
	nextstate = -1;
	condition = get_flag(8,13) == 1;
	question = "(Tell her what's on her tomb)";
	text1 = "You tell the ghost her name, and what the tomb says she did in life. Though there's not much to say, you can see her form become slightly more substantial as you say it.";
	text2 = "_Mother Reese... I was a priestess. That's it! Thank you!_";
	code = 
		set_flag(8,13,2);
		set_name(43,"Mother Reese");
	break;
begintalknode 65;
	state = -1;
	nextstate = -1;
	question = "Ghost";
	text1 = "Unlike the soldiers, this ghost has not kept its shape. In fact, the ghost is pretty much completely transparent, and just barely holds the shape of a humanoid.";
	text2 = "Like most ghosts you've seen, this ghost has not kept the shape it held in life. In fact, the ghost is pretty much completely transparent, and just barely holds the shape of a humanoid.";
	text3 = "If it's trying to communicate with you, it's impossible to tell.";
	code = 
		if(get_flag(50,0) == 1)
			remove_string(2);
		else
		remove_string(1);
	break;
